<template>
  <div>
    <div style="margin-bottom: 1rem;"></div>
    <!-- <BreakSpace label="维修项目列表" :containerStyle="{ marginBottom: '10px' }" /> -->
    <FilterTable
      ref="table"
      :columns="columns"
      :params="fetchParams"
      :fetchapi="fetchapi"
      :datakey="'records'"
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :is-select-column="false"
      height="auto"
      :isPagination = true
    >
    </FilterTable>
  </div>
</template>
<script>
  import { getAuditRecord } from '@/api/claim/dealer/AuthApplication';
  export default {
    // mixins: [dictionary],
    props:['authId'],
    data() {
      return {
        dataList: [],
        dataList1: [],
        visible: false,
        visibleDrawer: false,
        collapse: false,
        infoId: null,
        // topFilterInit: this.topFilterInitFun(),
        flterValue: {}, //参数
        columns: this.creatHeader(),
        fetchapi: getAuditRecord,
        fetchParams: {  authId:this.authId }, //ipa 接口
        selectedRows: [], //选中经销商
        formList: this.createFormList(),
        saveData: null,
        activeName: '',
        menus: [
          {
            title: '审核记录',
            path: 'tabs/user',
            params: {
              type: 1
            }
          },
          {
            title: '维修历史',
            path: 'tabs/setting',
            disabled: true,
            params: {
              type: 2
            }
          }
        ]
      };
    },
    created() {
      console.log(this.dataList);
    },
    methods: {
      formChangeHandle(val) {
        console.log(val);
        this.saveData = val;
      },
      //搜索获取数据
      changeHandle(val) {
        this.fetchParams = Object.assign({}, this.fetchParams, val);
        console.log(val);
      },
      //选中
      selectChange(rows) {
        this.selectedRows = rows;
        console.log(this.selectedRows);
      },
      //保存
      saveDialog() {
        this.$refs.formPanel1.SUBMIT_FORM();
        if (this.saveData) {
          this.$emit('save', this.selectedRows);
        }
      },
      //取消操作
      closeDialog() {
        this.$emit('close', { visible: false, data: this.selectedRows, type: 'close' });
      },
      chooseOrderNo() {
        this.visible = true;
      },
      add() {},
      createFormList() {
        return [
          {
            type: 'INPUT',
            label: '搜索',
            fieldName: 'title',
            placeholder: '请输入标题名称...',
            rules: [{ required: true, message: '请输入标题名称', trigger: 'blur' }, { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }],
            readonly: true // 只读
          },
          {
            type: 'SELECT',
            label: '所属分类',
            fieldName: 'cid',
            placeholder: '所属分类',
            itemList: [{ text: '热点', value: '1' }, { text: '资讯', value: '2' }],
            rules: [{ required: true, message: '请选择所属分类', trigger: 'change' }],
            disabled: true // 禁用
          },
          {
            type: 'DATE',
            label: '日期',
            fieldName: 'date',
            placeholder: '选择日期',
            rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
          },
          {
            type: 'RANGE_DATE',
            label: '日期区间',
            style: { minWidth: '200px' },
            fieldName: 'startTime|endTime'
          },
          {
            type: 'MULTIPLE_SELECT',
            label: '兴趣爱好',
            fieldName: 'hobby',
            placeholder: '兴趣爱好',
            itemList: [{ text: '篮球', value: '1' }, { text: '足球', value: '2' }, { text: '乒乓球', value: '3' }],
            rules: [{ required: true, message: '请选择兴趣爱好', trigger: 'change' }]
          },
          {
            type: 'INPUT_NUMBER',
            label: '数量',
            fieldName: 'number',
            placeholder: '请输入数量...',
            initialValue: undefined,
            rules: [{ required: true, message: '请输入数量', trigger: 'blur' }]
          }
        ];
      },

      //table表头和数据源
      creatHeader() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: props => {
              return <span>{props.row.index + 1}</span>;
            }
          },
          { title: '操作人', dataIndex: 'checkBy', sorter: true },
          { title: '操作时间', dataIndex: 'updatedAt', sorter: true },
          { title: '操作后状态', dataIndex: 'statusStr', sorter: true },
          { title: '操作备注', dataIndex: 'checkRemarks', sorter: true }
        ];
      },

    }
  };
</script>

<style lang="less" scoped></style>
